]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
messageTray: Summarize notifications when messages queue up
authorDevyani Kota <divs.passion.18@gmail.com>
Tue, 21 Oct 2014 11:45:31 +0000 (17:15 +0530)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 27 Oct 2014 17:20:51 +0000 (18:20 +0100)
It is really annoying for the user to acknowledge multiple notifications
when they queue up. So, to prevent a notification flood that has to be
handled by the user one-by-one, a summarized-notification feature is
added which leaves a single summarized-notification for the user,
replacing multiple notifications if the number exceeds 1, which they may
or may not acknowledge. When this summarized-notification is acknowledged,
the message-tray is opened where they can view the notifications that were
summarized. This helps the user concentrate on his primary task
simultaneously informing them about the new notifications.

https://bugzilla.gnome.org/show_bug.cgi?id=702460

js/ui/messageTray.js

index cedb410eda603f3872140c360b04809e0da1abf3..ad7c5c8869d6b373a24c4c03c0619f32caeade4d 100644 (file)
@@ -2432,8 +2432,22 @@ const MessageTray = new Lang.Class({
             if (shouldShowNotification && nextNotification) {
                 let limited = this._busy || Main.layoutManager.bottomMonitor.inFullscreen;
                 let showNextNotification = (!limited || nextNotification.forFeedback || nextNotification.urgency == Urgency.CRITICAL);
-                if (showNextNotification)
-                    this._showNotification();
+                if (showNextNotification) {
+                    let len = this._notificationQueue.length;
+                    if (len > 1) {
+                        this._notificationQueue.length = 0;
+                        let source = new SystemNotificationSource();
+                        this.add(source);
+                        let notification = new Notification(source, ngettext("%d new message", "%d new messages", len).format(len));
+                        notification.setTransient(true);
+                        notification.connect('clicked', Lang.bind(this, function() {
+                            this.openTray();
+                        }));
+                        source.notify(notification);
+                    } else {
+                        this._showNotification();
+                    }
+                }
             }
         } else if (this._notificationState == State.SHOWN) {
             let expired = (this._userActiveWhileNotificationShown &&